#include <stdio.h>

int a[] = {3, 1, 4, 2, 5};

int findSecondMin() {
    int len = sizeof(a) / sizeof(a[0]);
    if (len < 2) {
        printf("数组元素不足2个！\n");
        return -1;
    }
    
    int min, min2;
    if (a[0] < a[1]) {
        min = a[0];
        min2 = a[1];
    } else {
        min = a[1];
        min2 = a[0];
    }
    
    for (int i = 2; i < len; i++) {
        if (a[i] < min) {
            min2 = min;
            min = a[i];
        } else if (a[i] < min2) {
            min2 = a[i];
        }
    }
    return min2;
}

int main(void) {
    int secondMin = findSecondMin();
    printf("数组中第二小的数是：%d\n", secondMin);
    return 0;
}